IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[CGO_EventGet]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 ) 
  DROP PROCEDURE CGO_EventGet
GO
  

SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
GO


/** Create Stored Procedures **/


CREATE PROCEDURE dbo.CGO_EventGet
  @PortalID INT,
  @EventID INT
AS 
  SELECT  EventID ,
          PortalID ,
          DateBegin ,
          DateEnd ,
          Name ,
          Description ,
          MaxEnrollment ,
          EnrollFee ,
          EnrollType ,
          ImageURL ,
          ImageType ,
          ImageWidth ,
          ImageHeight ,
          Status ,
          Category ,
          ImageDisplay ,
          Signups ,
          AllDayEvent ,
          Approved ,
          CreatedByID ,
          UC.Username AS CreateByUserName,
          CreatedDate ,
          LastUpdatedID ,
          UU.Username AS LastUpdateUserName,
          LastUpdateDate
  FROM    dbo.CGO_Event M
          LEFT JOIN dbo.Users UC ON M.CreatedByID=UC.UserID
          LEFT JOIN dbo.Users UU ON M.LastUpdatedID=UU.UserID
  WHERE   PortalID = @PortalID
          AND EventID = @EventID
GO
